<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<cms_Interface>" %>
<%@ Import Namespace="Vit.CMS" %>
<%@ Import Namespace="Vit.CMS.Data" %>
<% bool isNew = this.Model == null || this.Model.InterfaceId <= 0; %>
<div class="ui-widget ui-tabs">
    <ul>
        <li><a href="#basicinfo" title='Html.Localize("Interface.Info")'><%= Html.Localize("Interface.Info") %></a></li>
        <% if (!isNew)
           { %>
        <li><a href="#properties" title='<%=Html.Localize("Interface.Properties")%>'><%= Html.Localize("Interface.Properties")%></a></li>
        <li><a href="#attributes" title='<%=Html.Localize("Interface.Attributes")%>'><%= Html.Localize("Interface.Attributes")%></a></li>
        <%} %>
    </ul>
    <div id="basicinfo" class="ui-tabs-hide">
    <% Html.EnableClientValidation(); %>
    <%= Html.ValidationSummary("Data validation error") %>
    <% using (Html.BeginForm())
       { %>
        <table>
            <tr>
                <td>
                    <%= Html.LabelFor(o=>o.ApplicationName)%>
                </td>
                <td>
                    <%= Html.DisplayFor(o => o.ApplicationName)%>
                    <%= Html.Hidden("ID", this.Model.InterfaceId.ToString())%>
                    <%= Html.Hidden("SiteName", this.Model.ApplicationName)%>
                </td>
            </tr>
            <tr>
                <td>
                    <%= Html.LabelFor(o=>o.Name) %>
                </td>
                <td>
                    <%= Html.EditorFor(o => o.Name)%>
                    <%= Html.ValidationMessage("Name")%>
                </td>
            </tr>
            <tr>
                <td>
                    <%= Html.LabelFor(o=>o.Creator)%>
                </td>
                <td>
                    <%= Html.DisplayFor(o => o.Creator)%>
                    <%= Html.Hidden("Creator", this.Model.Creator)%>
                </td>
            </tr>
            <tr>
                <td>
                    <%= Html.LabelFor(o=>o.CreateTime)%>
                </td>
                <td>
                    <%= Html.DisplayFor(o => o.CreateTime)%>
                    <%= Html.Hidden("CreateTime", this.Model.CreateTime)%>
                </td>
            </tr>
        </table>
        <hr />
        <p>
            <input type="submit" value='<%= isNew ? Html.Localize("Create") : Html.Localize("Update") %>' class="ui-state-default ui-corner-all" />
        </p>
    <%} %>
    </div>
    <% if (!isNew)
       { %>
    <div id="properties" class="ui-tabs-hide">
        <%= Html.EditorForMany<cms_Interface, cms_Property>(o => o.cms_Properties)%>
        <a href="/CMS/Interface/NewProperty/<%= this.Model.InterfaceId %>" class="ajax" target="newProperty"><%= Html.Localize("New")%></a>
        <div id="newProperty" style="display:none;"></div>
    </div>
    <div id="attributes" class="ui-tabs-hide">
        <%= Html.EditorForMany<cms_Interface, cms_Attribute>(o => o.cms_InterfaceAttributes.ManyChildren(p=>p.cms_Attribute))%>
        <a href="/CMS/Interface/NewAttribute/<%= this.Model.InterfaceId %>"><%= Html.Localize("New")%></a>
    </div>
    <%} %>
</div>
